package com.cencat.user.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime;

/**
 * 权限查询DTO
 * @author cencat
 * @since 2024-01-01
 */
@Data
@Schema(description = "权限查询DTO")
public class PermissionQueryDTO {

    @Schema(description = "权限名称", example = "用户管理")
    private String permissionName;

    @Schema(description = "权限编码", example = "user:manage")
    private String permissionCode;

    @Schema(description = "权限类型（1-菜单，2-按钮，3-接口）", example = "1")
    private Integer permissionType;

    @Schema(description = "父权限ID", example = "0")
    private Long parentId;

    @Schema(description = "权限状态（0-禁用，1-正常）", example = "1")
    private Integer status;

    @Schema(description = "是否显示（0-否，1-是）", example = "1")
    private Integer isVisible;

    @Schema(description = "是否外链（0-否，1-是）", example = "0")
    private Integer isExternal;

    @NotNull(message = "租户ID不能为空")
    @Schema(description = "租户ID", example = "1", required = true)
    private Long tenantId;

    @Schema(description = "创建人ID", example = "1")
    private Long createBy;

    @Schema(description = "创建开始时间", example = "2024-01-01T00:00:00")
    private LocalDateTime createTimeStart;

    @Schema(description = "创建结束时间", example = "2024-12-31T23:59:59")
    private LocalDateTime createTimeEnd;

    @Schema(description = "更新开始时间", example = "2024-01-01T00:00:00")
    private LocalDateTime updateTimeStart;

    @Schema(description = "更新结束时间", example = "2024-12-31T23:59:59")
    private LocalDateTime updateTimeEnd;

    @Schema(description = "页码", example = "1")
    @Min(value = 1, message = "页码不能小于1")
    private Integer pageNum = 1;

    @Schema(description = "每页大小", example = "10")
    @Min(value = 1, message = "每页大小不能小于1")
    private Integer pageSize = 10;

    @Schema(description = "排序字段", example = "create_time")
    private String sortField;

    @Schema(description = "排序方向（ASC-升序，DESC-降序）", example = "DESC")
    private String sortOrder = "DESC";

    @Schema(description = "关键词搜索（权限名称或编码）", example = "用户")
    private String keyword;

    @Schema(description = "是否查询树形结构", example = "false")
    private Boolean isTree = false;

    @Schema(description = "是否包含按钮权限", example = "true")
    private Boolean includeButton = true;

    @Schema(description = "是否包含接口权限", example = "true")
    private Boolean includeApi = true;

    @Schema(description = "权限路径", example = "/user")
    private String permissionPath;

    @Schema(description = "组件路径", example = "@/views/user")
    private String component;
}